<?php
	global $res,$queryData;
  	$sqlcat = "SELECT * FROM tbl_kategori WHERE tipe='tipe_download'";
	$qrycat = mysql_query($sqlcat);
	$numcat = mysql_num_rows($qrycat);
	echo '<div id="tabs">';
	echo '<ul>';
	$i = 1;
	if ($numcat!=0) {
		while ($rowcat = mysql_fetch_object($qrycat)) {
			echo '<li><a href="#fragment-'.$i.'"><span>'.$rowcat->kategori.'</span></a></li>';
			$i++;
		}
	}
	echo '</ul>';
  	$sqlcat = "SELECT * FROM tbl_kategori WHERE tipe='tipe_download'";
	$qrycat = mysql_query($sqlcat);
	$numcat = mysql_num_rows($qrycat);
	$i = 1;
	if ($numcat!=0) {
		while ($rowcat = mysql_fetch_object($qrycat)) {
?>
<div id="fragment-<?php echo $i; ?>">
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="2">
  <tr>
    <th height="30"> <div align="center">Nama Berkas</div></th>
    <th width="120"> <div align="center">Tanggal Upload</div></th>
    <th width="50"> <div align="center">Berkas</div></th>
  </tr>
  <?php
			$sql1 = "SELECT * FROM tbl_upload WHERE (RIGHT(`data`,2)='DW' AND tipe='".$rowcat->kategori."') ORDER BY tanggal DESC LIMIT ".PAGE;
			(is_numeric($res[1])) ? $page = strip_tags($res[1]) : $page = 1;
			$numrec = 0;
			$perpage = PAGE;	//jumlah record yang ditampilkan perhalaman
			$defshow = DEFSHOW;
			if ($page!=1)
				$piro=($page-1)*$perpage;
			else
				$piro = 0;
			$x = 1;
			$num = 1;
			$kk = array();
			$qry1 = mysql_query($sql1);
			$num1 = mysql_num_rows($qry1);
			if ($num1!=0) {
				while ($row1 = mysql_fetch_object($qry1)) {
					$kk1[$numrec] = $row1->idx;
					$nama = explode("[spasi]",$row1->data);
					$ukuran = $nama[2];
					$tipe = $row1->tipe;
					if (!empty($nama[3]))
						$url = $nama[3];
					else
						$url = "NONE"; 
					$data = $x % 2;
					if ($data==0)
						$dataX = "ganjil";
					else
						$dataX = "genap"; 
?>
  <tr valign="top" class="<?php echo $dataX; ?>">
    <td><div align="left"><?php echo $nama[1]; ?></div></td>
    <td nowrap="nowrap"><div align="center"><?php echo $queryData->tanggalan($row1->tanggal); ?></div>
      <div align="center"></div></td>
    <td><div align="center">
      <?php
		if (file_exists($nama[0])) {
			echo "<a href=\"".$nama[0]."\" title=\"Download ".$nama[1]."\"><img src='".$dev_path."images/download.gif' alt=\"Download File ".$nama[1]."\" border='0'></a>";
		} else {
			echo "Data Tidak ada";
		};
	?>
    </div></td>
  </tr>
  <tr valign="top" class="<?php echo $dataX; ?>">
    <td colspan="3" class="author">Deskripsi:</td>
  </tr>
  <tr valign="top" class="<?php echo $dataX; ?>">
    <td colspan="2"><?php echo $nama[3]; ?></td>
    <td>&nbsp;</td>
  </tr>
  <tr valign="top" class="<?php echo $dataX; ?>">
    <td colspan="3"><hr /></td>
  </tr>
  <?php
					$x++;
					$num++;
				}
			}
?>
</table>
</div>
<?php
			$i++;
		}
	}
	echo '</div>';
?>